import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import {getUserDetailApi} from "@/api/loginRequest.js";
export const useUserStore = defineStore( 'user',()=>
{
    const userInfo = ref({})
     async function getUserDetail (params){
        const  response = await getUserDetailApi(params)
         userInfo.value = response.data
    }
    function clearUserInfo(){
        userInfo.value = {}
    }
    const UpdateUser=(userData)=>{
        userInfo.value = userData
    }
    return {userInfo,clearUserInfo,UpdateUser,getUserDetail}
},{
    persist:true,
    storage: localStorage,
})